var a = require("../export.js");

getApp(), require("../../../wxParse/wxParse.js");

Page({
    data: {
        Article: [],
        isShowLoading: !1,
        hasMore: !0,
        is_load_more: !0,
        limit: 5,
        pageNumber: 1,
        options: {},
        daodi: 0
    },
    onLoad: function(a) {
        this.init(a), this.setData({
            options: a
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.asPullDownRefresh();
    },
    onReachBottom: function() {
        this.asReachBottom();
    },
    asPullDownRefresh: function() {
        this.setData({
            datas: [],
            pageNumber: 1,
            hasMore: !0,
            is_load_more: !0
        });
        var t = {
            hasMore: this.data.hasMore,
            pageNumber: this.data.pageNumber,
            limit: this.data.limit,
            search: []
        };
        this.list(t), a.dg.stopPullDownRefresh();
    },
    asReachBottom: function() {
        var a = {
            hasMore: this.data.hasMore,
            pageNumber: this.data.pageNumber,
            limit: this.data.limit
        };
        this.list(a);
    },
    init: function(a) {
        a = {
            hasMore: this.data.hasMore,
            pageNumber: this.data.pageNumber,
            limit: this.data.limit,
            search: []
        }, this.list(a);
    },
    list: function(t) {
        var i = this;
        if (!t.hasMore) return this.setData({
            isShowLoading: !1
        }), !1;
        var e = {};
        e.pagesize = t.pageNumber, e.pagenum = t.limit, a.requestUtil.post(a._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getArticle.html", e, function(e) {
            var o = i.data.Article;
            0 != (e = e || []).length ? (0, a._)(e).map(function(a) {
                return i.setData({
                    daodi: 1
                }), a;
            }) : i.setData({
                daodi: 0
            }), o = 1 == t.pageNumber ? e || [] : o.concat(e || []), i.setData({
                isShowLoading: !1,
                hasMore: !(e.length < i.data.limit),
                pageNumber: t.pageNumber + 1,
                Article: o
            });
        }, this, {
            isShowLoading: !1
        });
    },
    goArticleInfo: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/pages/car/news-detail/news-detail?id=" + t
        });
    }
});